/*Copyright ©2015 TommyLemon(https://github.com/TommyLemon)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/

package com.esm.pdafx.util;

import java.util.HashMap;
import java.util.Map;

import zuo.biao.library.interfaces.OnHttpResponseListener;
import zuo.biao.library.manager.HttpManager;


public class HttpRequest {


    public static void translate(String word, final int requestCode, final OnHttpResponseListener listener) {
        Map<String, Object> request = new HashMap<>();
        request.put("q", word);
        request.put("keyfrom", "ZBLibrary");
        request.put("key", 1430082675);
        request.put("type", "data");
        request.put("doctype", "json");
        request.put("version", "1.1");

        HttpManager.getInstance().get(request, "http://fanyi.youdao.com/openapi.do", requestCode, listener);
    }

    /*
     * http://192.168.111.251:18090/api/esm2/fengxianginfo?lpn=00037481-93cb-457a-b4f7-81f3bf5081cd_16
     */
    public static void fengxianginfo(String lpn, final int requestCode, final OnHttpResponseListener listener) {
        Map<String, Object> request = new HashMap<>();
        request.put("lpn", lpn);
        HttpManager.getInstance().get(request, "http://192.168.111.251:18090/api/esm2/fengxianginfo", requestCode, listener);
    }

    /*
     * http://192.168.111.251:18090/api/esm2/updatefxinfo
     */
    public static void updatefxinfo(String lpn, int isfx, String fxinfo_ncode, String fxinfo_num, final int requestCode, final OnHttpResponseListener listener) {
        Map<String, Object> request = new HashMap<>();
        request.put("lpn", lpn);
        request.put("isfx", isfx);
        request.put("fxinfo_ncode", fxinfo_ncode);//1637649925_7_1-bb3,1637649925_7_2-bb3,1637649925_7_3-bb3     ... 内盒码list
        request.put("fxinfo_num", fxinfo_num);//3,1,0 ... 内盒 扫码数list

        HttpManager.getInstance().post(request, "http://192.168.111.251:18090/api/esm2/updatefxinfo", requestCode, listener);
    }

    /*
     * http://192.168.111.251:18090/api/esm2/fengxiangbase
     */
    public static void fengxiangbase(final int requestCode, final OnHttpResponseListener listener) {
        Map<String, Object> request = new HashMap<>();

        HttpManager.getInstance().post(request, "http://192.168.111.251:18090/api/esm2/fengxiangbase", requestCode, listener);
    }

}